package com.ym.controller.soso;

import com.github.pagehelper.PageInfo;
import com.ym.common.constant.Constants;
import com.ym.common.utils.page.PageDomain;
import com.ym.core.annotation.Log;
import com.ym.core.domain.APIResponse;
import com.ym.core.domain.BaseController;
import com.ym.medical.domain.param.PolyclinicSimQueryParam;
import com.ym.medical.domain.vo.PolyclinicSimVO;
import com.ym.soso.domain.entity.PolyclinicEntity;
import com.ym.soso.service.IPolyclinicSV;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 综合门诊 Controller
 * 
 * @author ym
 * @date 2020-09-02
 */
@Api(tags = "mobile-综合门诊 ")
@RestController
@Validated
@RequestMapping(value = "/soso/polyclinic", headers = Constants.Api.VERSION)
public class PolyclinicController extends BaseController {

    @Autowired
    private IPolyclinicSV polyclinicSV;

    @ApiOperation("查询综合门诊列表")
    @Log
    @GetMapping("/list")
    public APIResponse<PageInfo<PolyclinicSimVO>> list(@Valid PolyclinicSimQueryParam queryParam) {
        PageDomain.startPage();
        List<PolyclinicSimVO> list = polyclinicSV.selectListMobile(queryParam);
        return successPage(list);
    }

    @ApiOperation("获取综合门诊 详细信息")
    @Log
    @GetMapping(value = "/info")
    public APIResponse<PolyclinicEntity> info(@RequestParam Long id) {
        PolyclinicEntity data = polyclinicSV.selectById(id);
        return successData(data);
    }

}
